ColorDialog
Color = ColorDialog([InitialColor], [FullOpenFlag]]=whether the dialogs is shown fully expanded ot not)
 
Parameters:

    [InitialColor] = the color that is initially selected when dialog is open
    [FullOpenFlag]]=whether the dialogs is shown fully expanded ot not
Returns:

    Color=The color the user chose or -1 if the dialog was cancelled
 

     ColorDialog opens a color dialog where the user can pick a color.

Returns the selected color in RGB format or -1 if the user cancelled the dialog.

* InitialColor = the color that is initially selected when dialog is open. This is optional and defaults to black
* FullOpenFlag = if set to 1 the dialog is fully expanded and shows RGB and HSB sliders. If set to 0 the dialog is not expanded but the user can press a button to fully expand the dialog. If set to -1 the dialog is not expanded and the user cannot expand it either. The default value is 0.



FACTS:


     * The ColorDialog returns a -1 value when the user selects cancel.

     * The ColorDialog returns colours in RGB format (24bit).

     * ColorDialog is not asynchronous, so the PlayBasic application will halt while the dialog is open.



Mini Tutorial:


     


  
; Include the Dialogs library in this program
  #Include "PBDialogs2"
  
  
; Init the Colour Palette of the Colour Dialog
  For lp=0 To 16
     ColorDialogColor(lp,RndRGB())
  Next
  
; Open the Colour Selection Dialog
  ThisColour=ColorDialog(RGB(255,255,255))
  
  If ThisColour<>-1
     
   ; Display message
     CenterText 400,180,"Here's your colour"
     BoxC 300,200,500,400,true,ThisColour
     
  Else
     CenterText 400,180,"You Pressed Cancel"
     
  EndIf
  
  
  // Display the screen & wait for a key press to end
  Sync
  WaitKey
  




 
Related Info: ColorDialogColor | GetColorDialogColor | RGB :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com